﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace Doc.SDK.Core.Model
{
    /// <summary>
    /// 发起授权请求参数
    /// </summary>
    public class RspQQDocAuthorize
    {
        public string client_id { get; set; }
        public string redirect_uri { get; set; }
        public string response_type { get; set; } = "code";
        public string scope { get; set; } = "all";
        public string state { get; set; } = Guid.NewGuid().ToString("N");
    }

    public class RequestBase
    {
        public string ToJson()
        {
            return JsonConvert.SerializeObject(this);
        }
    }
    #region 文件操作

    /// <summary>
    /// 文档类型，枚举值
    /// </summary>
    public enum doctype
    {
        /// <summary>
        /// 在线文档，默认值
        /// </summary>
        doc,
        /// <summary>
        /// 在线表格
        /// </summary>
        sheet,
        /// <summary>
        /// 在线收集表
        /// </summary>
        form,
        /// <summary>
        /// 在线幻灯片
        /// </summary>
        slide,
        /// <summary>
        /// 在线思维导图
        /// </summary>
        mind,
        /// <summary>
        /// 在线流程图
        /// </summary>
        flowchart
    }
    /// <summary>
    /// 新建文档请求参数
    /// </summary>
    public class Rspfiles: RequestBase
    {
        /// <summary>
        /// 文档的标题
        /// </summary>
        public string title { get; set; }
        /// <summary>
        /// 文档类型，枚举值
        /// </summary>
        public string type { get; set; }
        /// <summary>
        /// 文档模板唯一标识，默认创建空白文档
        /// </summary>
        public int templateID { get; set; }
        /// <summary>
        /// 文档所在文件夹唯一标识，默认为/
        /// </summary>
        public string folderID { get; set; }
    }

    /// <summary>
    /// 更新文档
    /// </summary>
    public class Rspfilesupdate : RequestBase
    {
        /// <summary>
        /// 文档新标题
        /// </summary>
        public string title { get; set; }
    }
    /// <summary>
    /// 移动文档请求体
    /// </summary>
    public class Rspfilesmove : RequestBase
    {
        /// <summary>
        /// 移动的目标文件夹唯一标识，默认为/
        /// </summary>
        public string targetFolderID { get; set; }
        /// <summary>
        /// 上级文件夹唯一标识，默认为/
        /// </summary>
        public string parentFolderID { get; set; }
        /// <summary>
        /// 如果列表类型是共享文件夹，需要传递该值，为共享文件夹最外层的文件夹唯一标识
        /// </summary>
        public string shareKey { get; set; }

    }
    /// <summary>
    /// 删除文档请求参数
    /// </summary>
    public class Rspfilesdelete : RequestBase
    {
        /// <summary>
        /// 文档唯一标识，详见文档ID
        /// </summary>
        public string fileID { get; set; }

        /// <summary>
        /// 文件所属的列表类型（origin：源文件，shared：共享文件，recent：浏览记录，trash：回收站文件），默认值是origin
        /// </summary>
        public string type { get; set; }
        /// <summary>
        /// 是否删除到回收站（0：彻底删除，1：删除到回收站），默认值是彻底删除。删除回收站、浏览记录中的文件时，结果都是彻底删除。
        /// </summary>
        public int recoverable { get; set; }

    }
    /// <summary>
    /// 生成副本
    /// </summary>
    public class Rspfilescopy : RequestBase
    {
        /// <summary>
        /// 新文档的标题
        /// </summary>
        public string title { get; set; }

        /// <summary>
        /// 新文档所在目录的唯一标识，默认为“我的文档”
        /// </summary>
        public string folderID { get; set; }

    }
    /// <summary>
    /// 星标文档
    /// </summary>
    public class Rspfilesstar : RequestBase
    {
        /// <summary>
        /// 星标操作。1：星标，2：取消星标
        /// </summary>
        public string star { get; set; }
    }
    /// <summary>
    /// 置顶文档
    /// </summary>
    public class Rspfilespin : RequestBase
    {
        /// <summary>
        /// 置顶操作。1：置顶，2：取消置顶
        /// </summary>
        public string pin { get; set; }

        /// <summary>
        /// 需置顶文档所在的目录。默认为/
        /// </summary>
        public string folderID { get; set; }

    }
    /// <summary>
    /// 设置水印
    /// </summary>
    public class Rspfileswatermark : RequestBase
    {
        /// <summary>
        /// 文档水印文本。默认为取消设置文字水印（不影响访客水印）
        /// </summary>
        public string text { get; set; }

        /// <summary>
        /// 是否设置访客水印。1：设置访客水印，2：取消设置访客水印
        /// </summary>
        public int visitorMark { get; set; }
        /// <summary>
        /// 水印显示类型。loose：宽松型，tight：密集型
        /// </summary>
        public string margin { get; set; }
        /// <summary>
        /// 水印是否对文档所有者隐藏。1：隐藏，2：不隐藏
        /// </summary>
        public int hideFromOwner { get; set; }

    }
    /// <summary>
    /// 获取克隆票据
    /// </summary>
    public class Rspfilesclonekey : RequestBase
    {
        /// <summary>
        /// 可以克隆该文档的用户OpenID
        /// </summary>
        public string targetOpenID { get; set; }
    }
    /// <summary>
    /// 克隆文档
    /// </summary>
    public class Rspfilesclone : RequestBase
    {
        /// <summary>
        /// 文档克隆临时票据
        /// </summary>
        public string fileCloneKey { get; set; }

        /// <summary>
        /// 生成的新文档名
        /// </summary>
        public string title { get; set; }
        /// <summary>
        /// 目标文件夹，默认为根文件夹
        /// </summary>
        public string folderID { get; set; }

    }
    /// <summary>
    /// 导出文档
    /// </summary>
    public class Rspfilesasyncexport : RequestBase
    {
        /// <summary>
        /// 可选枚举值:pdf，默认导出为对应类型的文档，目前只支持doc,slide导出为pdf
        /// </summary>
        public string exportType { get; set; }
    }
    /// <summary>
    /// 导出进度查询
    /// </summary>
    public class Rspfilesexportprogress : RequestBase
    {
        /// <summary>
        /// 操作ID
        /// </summary>
        public string operationID { get; set; }

    }
    /// <summary>
    /// 预导入文档
    /// </summary>
    public class Rspfilespreimport : RequestBase
    {
        /// <summary>
        /// 文件的MD5值
        /// </summary>
        public string fileMD5 { get; set; }

        /// <summary>
        /// 文件名，支持的文件名后缀：xls,xlsx,csv,doc,docx,txt,text,ppt,pptx,pdf,xmind,pos
        /// </summary>
        public string fileName { get; set; }
        /// <summary>
        /// 文件大小，单位为字节
        /// </summary>
        public int fileSize { get; set; }

    }
    /// <summary>
    /// 异步导入文档
    /// </summary>
    public class Rspfilesasyncimport : RequestBase
    {
        /// <summary>
        /// 文档的MD5值
        /// </summary>
        public string fileMD5 { get; set; }

        /// <summary>
        /// 文件名
        /// </summary>
        public string fileName { get; set; }
        /// <summary>
        /// 目标文件夹，默认为根文件夹
        /// </summary>
        public string parentFolderID { get; set; }
        /// <summary>
        /// 如果是加密文档，需要提供文档密码
        /// </summary>
        public string filePassword { get; set; }
        /// <summary>
        /// 调用pre-import返回的COSFileKey
        /// </summary>
        public string COSFileKey { get; set; }

    }
    /// <summary>
    /// 查询导入进度
    /// </summary>
    public class Rspfilesimportprogress : RequestBase
    {
        /// <summary>
        /// 进度查询凭证
        /// </summary>
        public string progressQueryID { get; set; }
    }
    /// <summary>
    /// 创建快捷方式
    /// </summary>
    public class Rspfilesshortcut : RequestBase
    {
        /// <summary>
        /// 创建快捷方式的目标folder id，默认为/
        /// </summary>
        public string targetFolderID { get; set; }

        /// <summary>
        /// 见列表类型，默认为folder https://docs.qq.com/open/wiki/driveapi/v2/common/list_type.html
        /// </summary>
        public string listType { get; set; }
        /// <summary>
        /// 共享文件夹最外层的文件夹唯一标识, 如果列表类型是共享文件夹，需要传递该值
        /// </summary>
        public string shareKey { get; set; }
    }
    #endregion

    #region 文件夹操作
    /// <summary>
    /// 添加文件夹
    /// </summary>
    public class Rspfolders : RequestBase
    {
        /// <summary>
        ///文件夹名称
        /// </summary>
        public string title { get; set; }

        /// <summary>
        /// 上级文件夹唯一标识，默认为根目录
        /// </summary>
        public string parentFolderID { get; set; }
    }
    /// <summary>
    /// 添加文件夹
    /// </summary>
    public class RspfoldersDelete : RequestBase
    {
        /// <summary>
        ///	见列表类型，默认为folder
        /// </summary>
        public string listType { get; set; }

        /// <summary>
        /// 共享文件夹最外层的文件夹唯一标识。listType是shared时必填
        /// </summary>
        public string shareKey { get; set; }
        /// <summary>
        /// 被删除文件夹原ID。listType是trash时必填
        /// </summary>
        public string originFolderID { get; set; }
    }
    /// <summary>
    /// 获取文档列表
    /// </summary>
    public class Rspfolderslist
    {
        /// <summary>
        ///排序类型，最近浏览（默认）modify 最近编辑title 按标题
        /// </summary>
        public string sortType { get; set; }

        /// <summary>
        /// 排列顺序。1：正序；0：倒序，默认值
        /// </summary>
        public int asc { get; set; }
        /// <summary>
        ///开始值，默认为0
        /// </summary>
        public int start { get; set; }
        /// <summary>
        ///拉取条目，默认为20
        /// </summary>
        public int limit { get; set; }
    }
    #endregion

    #region 权限操作


    /// <summary>
    /// 设置文档权限
    /// </summary>
    public class RspAuthpermission : RequestBase
    {
        /// <summary>
        /// private	仅文档拥有者可查看和编辑
        /// members 指定用户可查看/编辑
        /// publicRead 任何人可查看
        /// publicWrite 任何人可编辑
        /// </summary>
        public string policy { get; set; }

        /// <summary>
        /// 是否允许查看者复制、保存为本地文件、打印内容，默认为true(允许)
        /// </summary>
        public string copyEnabled { get; set; }
        /// <summary>
        /// 是否允许只读者批注，默认为true(允许)
        /// </summary>
        public string readerCommentEnabled { get; set; }
    }
    /// <summary>
    /// 申请文档权限
    /// </summary>
    public class RspAuthapply : RequestBase
    {
        /// <summary>
        /// 权限类型read：申请查看权限        write：申请编辑权限
        /// </summary>
        public string type { get; set; }

        /// <summary>
        /// 申请权限备注信息
        /// </summary>
        public string memo { get; set; }
       
    }
    /// <summary>
    /// 添加协作成员 他是Array
    /// </summary>
    public class RspAuthcollaborators : RequestBase
    {
        /// <summary>
        /// 固定填写user
        /// </summary>
        public string type { get; set; }

        /// <summary>
        /// 协作成员身份        reader：浏览者        writer：编辑者
        /// </summary>
        public string role { get; set; }
        /// <summary>
        /// 协作者的openID
        /// </summary>
        public string id { get; set; }

    }
    /// <summary>
    /// 转让文档所有权
    /// </summary>
    public class RspAuthownership : RequestBase
    {
        /// <summary>
        ///文档新所有者的openID
        /// </summary>
        public string ownerID { get; set; }
    }
    #endregion

    #region 表格操作


    /// <summary>
    /// 添加子表
    /// </summary>
    public class RspSheetaddSheet : RequestBase
    {
        /// <summary>
        ///添加子表请求
        /// </summary>
        public object addSheet { get; set; }


    }
    /// <summary>
    /// 删除多行（列）
    /// </summary>
    public class RspSheetdelerowcol : RequestBase
    {
        /// <summary>
        /// 删除多行（列）请求
        /// </summary>
        public object deleteDimension { get; set; }
    }

    #endregion

}
